package com.carreirati.evaluation;

import java.util.List;

import com.carreirati.evaluation.domain.Profile;
import com.carreirati.evaluation.domain.Project;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.roo.addon.web.mvc.controller.json.RooWebJson;
import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/projects")
@Controller
@RooWebScaffold(path = "projects", formBackingObject = Project.class)
@RooWebJson(jsonObject = Project.class)
public class ProjectController {
	

	@RequestMapping(value = "/getselectedprojectbyknowledgearea{knowledgeAreaId}", headers = "Accept=application/json")
    @ResponseBody
    public ResponseEntity<java.lang.String> findProjectbyKnowledgeAreaJson(@PathVariable("knowledgeAreaId") long knowledgeAreaId) {
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json; charset=utf-8");
        List<Project> result = Project.findByKnowledgeArea(knowledgeAreaId);
        return new ResponseEntity<String>(Project.toJsonArray(result), headers, HttpStatus.OK);
    }
}
